
import { createSlice, PayloadAction, createAsyncThunk } from '@reduxjs/toolkit'
import api from '@/api'
import Taro from '@tarojs/taro'

const initialState = {
  qrcode: false,
  codestr:'',
  
}


const qrcodeSlice = createSlice({
  name: 'qrcode',
  initialState,
  reducers: {
    updateQRCode: (state, { payload }) => {
     const{qrcode,codestr} = payload
      state.qrcode = qrcode
      state.codestr = codestr
    },

    updateCodestr: (state, {payload}) => {
      state.codestr = payload
    },

    setupdateQRCode: (state) => {
      state.qrcode = false
      state.codestr = ''
    }
    },
  
})

export const { updateQRCode, updateCodestr, setupdateQRCode } =
qrcodeSlice.actions

export default qrcodeSlice.reducer